package com.jeesite.modules.car.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 车辆详情Entity
 * @author qu
 * @version 2023-12-11
 */
@Table(name="h_car", alias="a", label="车辆详情信息", columns={
		@Column(name="car_id", attrName="carId", label="主键id", isPK=true),
		@Column(name="type_id", attrName="typeId", label="类型id"),
		@Column(name="car_title", attrName="carTitle", label="名称", queryType=QueryType.LIKE),
		@Column(name="brand", attrName="brand", label="品牌"),
		@Column(name="sell_price", attrName="sellPrice", label="售卖价格"),
		@Column(name="kilometer", attrName="kilometer", label="公里数"),
		@Column(name="cover_url", attrName="coverUrl", label="封面照片"),
		@Column(name="transfers", attrName="transfers", label="过户次数", isUpdateForce=true),
		@Column(name="register_date", attrName="registerDate", label="上户日期", isUpdateForce=true),
		@Column(name="cylinder", attrName="cylinder", label="汽缸"),
		@Column(name="car_label", attrName="carLabel", label="车辆标签"),
		@Column(name="explain", attrName="explain", label="详细说明"),
		@Column(name="car_status", attrName="carStatus", label="状态（0已通过 1已删除 2已下架 3待审核 4未通过 9已撤销）"),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者"),
		@Column(name="update_date", attrName="updateDate", label="更新时间"),
		@Column(name="remarks", attrName="remarks", label="备注信息"),
	},joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity= CarType.class, alias="t",
				on="a.type_id = t.type_code", attrName="this",
				columns={
						@Column(name="tree_name", attrName="treeName", label="节点名称", queryType=QueryType.LIKE, isTreeName=true),
						@Column(name="big_type", attrName="bigType", label="归属大类", comment="归属大类（0汽车 1摩托车）"),
				}),
}, orderBy="a.update_date DESC"
)
public class Car extends DataEntity<Car> {
	
	private static final long serialVersionUID = 1L;
	private String carId;		// 主键id
	private String typeId;		// 类型id
	private String carTitle;		// 名称
	private String brand;		// 品牌
	private Integer sellPrice;		// 售卖价格
	private String showSellPrice;		// 显示价格
	private Integer kilometer;		// 公里数
	private String coverUrl;		// 封面照片
	private Integer transfers;		// 过户次数
	private Date registerDate;		// 上户日期
	private String showDate;		// 显示日期
	private String cylinder;		// 汽缸
	private String explain;		// 详细说明
	private String carLabel;		// 标签
	private String treeName;		// 类型名称
	private String bigType;		// 归属大类
	private String carStatus;		// 查询状态
	private String imageUrl;		// 图片路径
	private String imageType;		// 图片类型
	private List<Image> carousel;// 轮播
	private List<Image> detail;	// 详情

	public Car() {
		this(null);
	}
	
	public Car(String id){
		super(id);
	}

	public List<Image> getCarousel() {
		return carousel;
	}

	public void setCarousel(List<Image> carousel) {
		this.carousel = carousel;
	}

	public List<Image> getDetail() {
		return detail;
	}

	public void setDetail(List<Image> detail) {
		this.detail = detail;
	}

	public String getCarId() {
		return carId;
	}

	public void setCarId(String carId) {
		this.carId = carId;
	}
	
	@NotBlank(message="类型id不能为空")
	@Size(min=0, max=64, message="类型id长度不能超过 64 个字符")
	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	
	@NotBlank(message="名称不能为空")
	@Size(min=0, max=64, message="名称长度不能超过 64 个字符")
	public String getCarTitle() {
		return carTitle;
	}

	public void setCarTitle(String carTitle) {
		this.carTitle = carTitle;
	}
	
	@Size(min=0, max=32, message="品牌长度不能超过 32 个字符")
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}
	
	@NotNull(message="售卖价格不能为空")
	public Integer getSellPrice() {
		return sellPrice;
	}

	public void setSellPrice(Integer sellPrice) {
		this.sellPrice = sellPrice;
	}

	@Size(min=0, max=128, message="封面照片长度不能超过 128 个字符")
	public String getCoverUrl() {
		return coverUrl;
	}

	public void setCoverUrl(String coverUrl) {
		this.coverUrl = coverUrl;
	}
	
	public Integer getTransfers() {
		return transfers;
	}

	public void setTransfers(Integer transfers) {
		this.transfers = transfers;
	}
	
	@JsonFormat(pattern = "yyyy-MM")
	public Date getRegisterDate() {
		return registerDate;
	}

	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}
	
	@Size(min=0, max=16, message="汽缸长度不能超过 16 个字符")
	public String getCylinder() {
		return cylinder;
	}

	public void setCylinder(String cylinder) {
		this.cylinder = cylinder;
	}

	public String getExplain() {
		return explain;
	}

	public void setExplain(String explain) {
		this.explain = explain;
	}

	public Integer getKilometer() {
		return kilometer;
	}
	public void setKilometer(Integer kilometer) {
		this.kilometer = kilometer;
	}

	public String getCarLabel() {
		return carLabel;
	}

	public void setCarLabel(String carLabel) {
		this.carLabel = carLabel;
	}

	public String getTreeName() {
		return treeName;
	}

	public void setTreeName(String treeName) {
		this.treeName = treeName;
	}

	public String getBigType() {
		return bigType;
	}

	public void setBigType(String bigType) {
		this.bigType = bigType;
	}

	public String getCarStatus() {
		return carStatus;
	}

	public void setCarStatus(String carStatus) {
		this.carStatus = carStatus;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getImageType() {
		return imageType;
	}

	public void setImageType(String imageType) {
		this.imageType = imageType;
	}

	public String getShowSellPrice() {
		return showSellPrice;
	}

	public void setShowSellPrice(String showSellPrice) {
		this.showSellPrice = showSellPrice;
	}

	public String getShowDate() {
		return showDate;
	}

	public void setShowDate(String showDate) {
		this.showDate = showDate;
	}
}